﻿using System;
using System.Windows.Forms;
using XCI.Excel;
using XCI.Setting;

namespace XCI.Core
{
    /// <summary>
    /// 应用程序全局对象
    /// </summary>
    public static class App
    {
        /// <summary>
        /// 处理器实例
        /// </summary>
        public static AppHandler Handler { get; internal set; }

        /// <summary>
        /// 启动参数
        /// </summary>
        public static Map StartupArgs { get; internal set; }

        /// <summary>
        /// 闪屏类型
        /// </summary>
        public static Type SplashScreenType { get; internal set; }

        /// <summary>
        /// 应用配置
        /// </summary>
        public static AppSetting Setting { get; internal set; }

        /// <summary>
        /// 客户端操作系统名称
        /// </summary>
        public static string ClientOsName { get; internal set; }

        /// <summary>
        /// 客户端操作系统版本
        /// </summary>
        public static string ClientOsVersion { get; internal set; }

        /// <summary>
        /// 客户端DevExpress控件版本
        /// </summary>
        public static string ClientDevExpressVersion { get; internal set; }

        /// <summary>
        /// 客户端XCI框架版本
        /// </summary>
        public static string ClientXCIVersion { get; internal set; }

        /// <summary>
        /// 客户端代理字符串
        /// </summary>
        public static string ClientUserAgent { get; internal set; }

        /// <summary>
        /// 等待窗体型
        /// </summary>
        public static Type WaitFormType { get; internal set; }

        /// <summary>
        /// 应用服务器对象
        /// </summary>
        public static WebApiClient Client { get; internal set; }

        /// <summary>
        /// 文件服务器对象
        /// </summary>
        public static WebApiClient FileClient { get; internal set; }

        /// <summary>
        /// 配置存储对象
        /// </summary>
        public static ISettingStore SettingStore { get; internal set; }

        /// <summary>
        /// 模型验证器
        /// </summary>
        public static ModelValidator Validator { get; internal set; }

        /// <summary>
        /// 容器数据操作器
        /// </summary>
        public static ContainerData ContainerData { get; internal set; }

        /// <summary>
        /// Excel导入导出对象
        /// </summary>
        public static ExcelData Excel { get; internal set; }

        /// <summary>
        /// 主窗体实例
        /// </summary>
        public static Form StartupForm { get; internal set; }

        public static WinFormClientInfo GetWinFormClientInfo()
        {
            return new WinFormClientInfo
            {
                DevExpress = ClientDevExpressVersion,
                XciCore = ClientXCIVersion
            };
        }
    }
}